	
<script type="text/javascript" charset="UTF-8">
	var takerCombogrid;
	var addProjectForm;
	var sexData = [{
		"id":"male",
		"text":"男"
	},{
		"id":"female",
		"text":"女",
	}];
	
	$(function(){
	console.info(top);
	addProjectForm = $('#addProjectForm').form({
			url:'servlet/AddProjectServlet',
			onSubmit: function(){   
				 	var pdetail =  $.trim($("#pdetail").val()) != "",
				 		isValid = $(this).form('validate');
					var result =isValid  && pdetail;
					if(!result) {
						$.messager.alert('请填写完整', '请填写完整！', 'error');
						return false;
					}
					
   				 },
			success: function(msg){
				if(msg == 'ok') {
					$('#addProjectDialog').dialog('close');
					 var tab = $("#menuTab").tabs('getSelected');
			 		$("#menuTab").tabs('update', {
                       	tab:tab,
						 options:tab.panel('options')
					}); 
					$.messager.show({
						title:'提示',
						msg:'添加项目成功'
					});
				} else {
					$.messager.alert('添加项目失败','添加项目失败！','error');
					console.info('error');
				}
			}
	});
	takerCombogrid = $('#takerCombogrid').combogrid({   
		url:'servlet/GetTakerServlet',
		fitColumns:true,
		mode:'remote',
		panelWidth:450,
		nowrap:false,
		idField:'sno',
		textField: 'sname',
		pagination:false,
		editable:false,
		required:true,
		multiple:true,
		fit:true,
		border:false,
		sortName:'sno',
		sortOrder:'desc',
		columns:[[{
			field:'cut',
			checkbox:true
		},{
			title:'学号',
			field:'sno',
			width:100,
			sortable:true
		},{
			title:'姓名',
			field:'sname',
			width:100,
			sortable:true
		},{
			title:'性别',
			field:'sex',
			width:100,
			sortable:true,
			formatter:function(value,rowData,rowIndex){
				 for(var i=0; i<sexData.length; i++){  
		                if (sexData[i].id == value) {
		                	return sexData[i].text;  
		                }
	            }  
			}
		},{
			title:'分工',
			field:'stype',
			width:100
		}]]
	});  

});
		
cleanAdd = function() {
	addProjectForm.find('input').val('');
	addProjectForm.find('textarea').val('');
	takerCombogrid.combogrid('setValue','');
}
</script>


<div style="width:600px;margin:0 auto;">
		<form id="addProjectForm" style="margin:40px auto;" method="post"  enctype="multipart/form-data">
				<table style="margin:auto;border:1px #09F solid;">
					<tr style="width:70px;">
						<td style="width:100px;text-align:left"><b>项目名称</b></td>
						<td><input type="text" name="pname" id="pname" class="easyui-validatebox" style="width:300px;" required="true"/></td>
					</tr>
					<tr style="width:70px;">
						<td style="width:100px;text-align:left"><b>参与人员</b></td>
						<td><input type="text" name="taker" id="takerCombogrid" style="width:300px;" /></td>
					</tr>
					<tr style="width:70px;">
						<td style="width:100px;text-align:left"><b>截止时间</b></td>
						<td><input type="text" name="etime" id="etime" style="width:200px;" class="easyui-datetimebox" required="true" editable="false"/></td>
					</tr>
					<tr>
						<td style="width:100px;text-align:left;vertical-align:top;"><b>项目描述</b></td>
						<td><textarea name="pdetail" id="pdetail" rows="10" cols="70" ></textarea></td>
					</tr>
					<tr style="width:70px;" class="addfile">
						<td style="width:60px;text-align:left"><b>添加附件</b></td>
						<td><input type="file" name="attach" id="attach"/></td> 
					</tr>
					<tr style="width:70px;display:none;" id="hiddenbox"> <!--往后台传送数据的容器-->	
					</tr>
					<tr>
						<td colspan="2" align="right">
							<a href="javascript:void(0);" class="easyui-linkbutton"  pain="false" onclick="addProjectForm.submit();" >确定</a>
							<a href="javascript:void(0);" class="easyui-linkbutton"  pain="false" onclick="cleanAdd();" >清空</a>
						</td>
					</tr>
					
				</table>
			</form>
</div>
<script type="text/javascript" src="js/addFile.js" charset="UTF-8"></script>  	